/************************************************************************************
* SimpleCollectionView.h                                                            *
*                                                                                   *
* Copyright (C) 2011 Varuna L Amachi                                                *
*                                                                                   *
* This program is free software; you can redistribute it and/or modify              *
* it under the terms of the GNU General Public License as published by              *
* the Free Software Foundation; either version 2 of the License, or any             *
* later version.                                                                    *
*                                                                                   *
* This program is distributed in the hope that it will be useful, but               *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY        *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for       *
* more details. You should have received a copy of the GNU General Public           *
* License along with this program; if not, write to the Free Software Foundation,   *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                       *
*                                                                                   *
*************************************************************************************/

#ifndef SIMPLECOLLECTIONVIEW_H
#define SIMPLECOLLECTIONVIEW_H

#include <QTreeView>
#include <QWidget>
#include <QList>
#include <QAction>

#include "widgets/SearchBox.h"
#include "PartialCollectionModel.h"
#include "SimpleCollectionSortFilter.h"
#include "collector/CollectorItem.h"

class SimpleCollectionView: public QWidget
{
    Q_OBJECT

public:
    SimpleCollectionView(PartialCollectionModel *model,
                         SimpleCollectionSortFilter *filter,
                         QWidget *parent = 0,
                         bool showFilter = true);
    ~SimpleCollectionView();

    PartialCollectionModel      *m_model;
    SimpleCollectionSortFilter  *m_proxyModel;
    bool m_showFilter;

    QTreeView* m_view;
    SearchBox* m_filter;

    QList<QAction *> *m_contextActions;
    QList<QAction *> *m_toolBarActions;

    void setupUi();
    void setupActions();
    void setupConnections();

public:
    void contextMenuEvent(QContextMenuEvent *event);
    PartialCollectionModel *model();
    QList<QString>* selectedTrackIds();

private slots:


public slots:
    void tableDoubleClicked();
    void setContextActions(QList<QAction *> *actions);
    void setSortingEnabled(bool value);
    void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
    void setFilterExpression(QString regEx);

signals:
    void itemActivated(CollectorItem *item);
    void contextMenuRequested();
};

#endif // SIMPLECOLLECTORVIEW_H
